<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>修改</title>
    <link href="__STATIC__/component/pear/css/pear.css" rel="stylesheet"/>
</head>
<body class="childrenBody {:dialog_css()}">

<form class="layui-form" action="{:url('edit')}" method="post">
    <input type="hidden" name="id" value="{$vo.id}"/>

    <div class="layui-form-item">
	<label class="layui-form-label layui-form-item-required">分类</label>
	<div class="layui-input-block">{:form_select('type_id', widget('model_field_options')->get(72), $vo['type_id'], '')}</div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label layui-form-item-required">标题</label>
	<div class="layui-input-block"><input type="text" name="title" value="{$vo.title}"  lay-verify="required" placeholder="请输入标题" class="layui-input"/></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label layui-form-item-required">图片</label>
	<div class="layui-input-block"><input type="hidden" id="image" name="image" value="{$vo.image}"  lay-verify="required"/><div class="upload-image layui-upload-drag aphp-upload" id="ID-upload-image-image" data-url="{:url('api/upload')}?api=default" data-accept="image" data-field="image">{empty $vo['image']:}<img id="image-preview" src="" style="display:none;" width="90" height="60" alt="image">上传图片<span id="image-remove" class="remove-pic">删除</span>{else:}<img id="image-preview" src="{$vo.image}" width="90" height="60" alt="image">上传图片<span id="image-remove" class="remove-pic" style="display: inline;">删除</span>{/empty}</div><button type="button" class="layui-btn layui-btn-sm" id="image-selected" data-url="{:url('attach/selected')}?type=image&dialog=1">图库选择</button></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">链接</label>
	<div class="layui-input-block"><input type="text" name="url" value="{$vo.url}"  lay-verify="url" placeholder="请输入链接" class="layui-input"/></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">打开方式</label>
	<div class="layui-input-block">{:form_radio('target', widget('model_field_options')->get(90), $vo['target'], '')}</div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">摘要</label>
	<div class="layui-input-block"><textarea name="summary" id="editor-summary" placeholder="请输入摘要" class="layui-textarea">{$vo.summary}</textarea></div>
</div>

<div class="layui-form-item">
	<label class="layui-form-label">排序</label>
	<div class="layui-input-block"><input type="number" name="sort" value="{$vo.sort}"  min="0" step="10" lay-affix="number" placeholder="请输入排序" class="layui-input"/></div>
</div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                修改
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

<script src="__STATIC__/component/layui/layui.js"></script>
<script src="__STATIC__/component/pear/pear.js"></script>
<script>
    layui.use(['aphpForm', 'aphp', 'form'], function () {
        var aphpForm = layui.aphpForm,
            aphp = layui.aphp,
            form = layui.form;

        aphpForm.bindEvent('form.layui-form');

        form.on('submit(save)', function (data) {
            aphp.request.postForm(data, 0, function () {
                if (window.parent.frames[0].name === 'cms_iframe') {
                    parent.location.reload();
                } else {
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                    parent.layui.table.reload('currentTable');
                }
            });
            return false;
        });
    })
</script>
</body>
</html>